<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:include page="../common/file.jsp" />
<head>
</head>
<body>
	<script type="text/javascript">
		//初始化滚动条
		$("html").niceScroll({cursorcolor:"#000000",zindex:999999,bouncescroll:true,cursoropacitymax:0.4,cursorborder:"",cursorborderradius:7,cursorwidth:"7px",background:"rgba(0,0,0,.1)",autohidemode:true,railpadding:{top:0,right:2,left:2,bottom:0}});
		//页面信息提示
		var returnMsg = "${_error}";
		var authoriMsg = "${_authoriError}";
	</script>
	<div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">
        <ol class="breadcrumb page-breadcrumb pull-left">
            <li><i class="fa fa-home"></i>&nbsp;<a href="${pageContext.request.contextPath}/user/list">客户管理</a>&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;</li>
            <li class="active">账号管理</li>
        </ol>
    </div>
    <div style="clear:both"></div>
	<div class="main-right-content">
		<div class="main-right-div">
			<div class="main-right-query-div">
				<form id="query-form-1" action="${pageContext.request.contextPath}/user/list" method="post">
					<div class="main-right-search row">
						<div class="col-lg-2">
						所属单位:<select class="select" id="organId" name="organId" style="height:30px"></select>
						</div>
						<div class="col-lg-2">
						&nbsp;&nbsp;&nbsp;&nbsp;状态:<select class="chosen-select form-control" id="status" name="status">
	                            <option value=""> --请选择-- </option>
								<option value="1" <c:if test="${user.status eq '1'}">selected</c:if>>有效</option>
								<option value="0" <c:if test="${user.status eq '0'}">selected</c:if>>注销</option>
                          	</select>
						</div>
						<div class="col-lg-2">
						&nbsp;&nbsp;&nbsp;&nbsp;账号:<input type="text" id="account" name="account" maxlength="20" value="<c:out value='${user.account}'/>" placeholder="请输入账号" />
						</div>
						<div class="col-lg-2">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<button type="button" class="btn btn-blue btn-query">查 询</button>
							<button type="button" class="btn btn-gray btn-rest">重 置</button>
							<button type="button" class="btn btn-red btn-add">新 增</button>
						</div>
					</div>
				</form>
			</div>
			<div style="clear: both;"></div>
			<div class="main-right-table-div">
				<table class="main-right-table">
					<colgroup>
						<col style="width: 6%;">
						<col style="width: 10%;">
						<col style="width: 7%;">
						<col style="width: 6%;">
						<col style="width: 6%;">
					</colgroup>
					<thead>
						<tr>
							<td>账号</td>
							<td>所属单位</td>
							<td>电话</td>
							<td>状态</td>
							<td>操作</td>
						</tr>
					</thead>
					<tbody>
						<c:if test="${list != null && list.size() > 0}">
							<c:forEach items="${list}" var="d" varStatus="st">
								<tr>
									<td style="text-align: center;"><span>${d.account}</span></td>
									<td style="text-align: center;"><span>${d.organName}</span></td>
									<td style="text-align: center;"><span>${d.mobileNo}</span></td>
									<td style="text-align: center;">
										<c:choose>
											<c:when test="${d.status == 1}">
												<span>有效</span>
											</c:when><c:when test="${d.status == 0}">
												<span>注销</span>
											</c:when>
										</c:choose>
									</td>
									<td style="text-align: center;">
										<a data-id="<c:out value='${d.userId}'/>" class="stylebuttonwee stylemedium stylesquare styleyellow row-query-btn" href="javascript:void(0);">详情</a>
										&nbsp;
										<a data-id="<c:out value='${d.userId}'/>" class="stylebuttonwee stylemedium stylesquare stylegreen row-update-btn" href="javascript:void(0);">修改</a>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						<c:if test="${list == null || list.size() <= 0}">
							<tr>
								<td colspan="6" style="padding: 5px; text-align: center;">查询无记录！</td>
							</tr>
						</c:if>
					</tbody>
				</table>
				<%@include file="../common/page.jsp" %>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		new Pagination({container: '.page',fm: '#query-form-1'});
		
		//下拉菜单树(所属单位)
		var ctxt = "${pageContext.request.contextPath}";
		$('#organId').combotree({
		    url : ctxt+'/organ/findAllTrees',
		    parentField : 'pid',
		    lines : true,
		    panelHeight : 'auto',
		    panelWeight : 'auto',
		    value : '${user.organId}',
		});
	
		// 查询
		$('.btn-query').click(function() {
			$('#query-form-1').submit();
		});
		
		// 重置
		$('.btn-rest').click(function() {
			window.location.href = $('#query-form-1').attr("action");
		});
		
		// 账号详情
		$('.row-query-btn').click(function() {
			var userId = $(this).data('id');
			art.dialog.open(ctxt + '/user/query?userId=' + userId, {
				title: '账号详情',width: 720,height: 365,lock: true,opacity: 0.1,cancel:true
			});
		});
		
		// 账号新增
		$(".btn-add").click(function(){
			art.dialog.open(ctxt + '/user/create', {
				title: '新增账号',width: 700,height: 415,lock: true,opacity: 0.3
			});
		});
		
		// 修改账号
		$('.row-update-btn').click(function() {
			var userId = $(this).data('id');
			art.dialog.open(ctxt + '/user/edit?userId='+userId, {
				title: '修改账号',width: 700,height: 415,lock: true,opacity: 0.3
			});
		});
		
		//下拉框初始化图形
		$(".chosen-select").chosen({disable_search_threshold: 10});
	</script>
</body>